<template>
  <div class="myBox">
    <div class="L"><img :src="userInfo.avatar_text?userInfo.avatar_text:'/assets/images/01.jpg'" /></div>
    <div class="C">
      <div class="tit">{{userInfo.nickname}}</div>
      <div class="sub">{{userInfo.mobile}}</div>
    </div>
  </div>

  <div class="allkbox"></div>

  <div class="myboxcon">
    <router-link class="router" to="/business/profile">
      <p>基本资料</p>
      <img src="/assets/images/go.png">
    </router-link>
  </div>
  <div v-if="userInfo.auth === '0'" class="myboxcon">
    <router-link class="router" to="/business/email">
      <p>邮箱认证</p>
      <img src="/assets/images/go.png">
    </router-link>
  </div>
  <div class="myboxcon">
    <router-link class="router" to="/address/index">
      <p>我的收货地址</p>
      <img src="/assets/images/go.png">
    </router-link>
  </div>
  <div class="myboxcon">
    <router-link class="router" to="/order/index">
      <p>我的订单</p>
      <img src="/assets/images/go.png">
    </router-link>
  </div>
  <div class="myboxcon">
    <router-link class="router" to="/business/record">
      <p>消费记录</p>
      <img src="/assets/images/go.png">
    </router-link>
  </div>
  <div class="myboxcon">
    <router-link class="router" to="/business/payment">
        <p>充值</p>
        <img src="/assets/images/go.png">
    </router-link>
  </div>
  <div class="myboxcon">
    <router-link class="router" to="/business/payRecord">
      <p>充值记录</p>
      <img src="/assets/images/go.png">
    </router-link>
  </div>
  <div class="myboxcon" @click="loginOut"> 
      <a href="javascript:void(0)" >
        <p>注销</p>
        <img src="/assets/images/go.png">
      </a>
  </div>

    <tabbar/>
</template>

<script setup>
  import tabbar from "@/components/tabbar.vue" 

  let {proxy} = getCurrentInstance()
  let userInfo = reactive(proxy.$cookies.get("business"));

  const loginOut = ()=>{
    proxy.$dialog({
      title:"退出",
      message:"确认退出吗?",
    })
    .then(()=>{
      // 清除cookies
      proxy.$cookies.remove("business");
      proxy.$success({
        message:"退出成功",
        duration:1000,
        onClose:()=>{
          proxy.$router.push("/business/login")
        }
      })
    })
    .catch((err)=>{
    })
  }
</script>

<style scoped>
  .router::after{
    content:"";
    clear: both;
    display: block;
    visibility: hidden;
  }
</style>